wiki = open('wiki.txt')
title = open('titles.txt','w')

i = 0
for line in wiki:
    if line.startswith("##TITLE##"):
        if i!= 0:
            pass
        i = 0
        title.write( line[10:].strip() + '\n')
    i += len(line.split() )
    
title.close()
